// api
import { login, userpermission } from "@/api/account"
const state = {
    buttonList: {},
    menuList: {}
};
const getters = {}
const mutations = {  // commit 
    SET_BUTTON(state, value){
        state.buttonList = value
    },
    SET_MENU(state, value){
        state.menuList = value
    }
}
const actions = {
    activeLogin({ commit }, payload){
        return new Promise(() => {
            login({
                ...payload,
                password: md5(formState.password)
                // qq111111 32位
              }).then(res => {
                setToken(res.content.token)
                userpermission()
                router.push('/library')
                loading.value = false
              }).catch((error) => {
                loading.value = false
                  console.log(error)
              })
        })
    }
}
export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
};